<script setup>
import {
    Management,
    Promotion,
    UserFilled,
    User,
    Crop,
    EditPen,
    SwitchButton,
    CaretBottom
} from '@element-plus/icons-vue'
import avatar from '@/assets/default.png'
import { ref,onMounted } from 'vue'
const teacherName = ref()
import { teacherInfoService } from '@/api/teacherApi/teacherInfo.js'
const getTeacherInfo = async () => {
    let result = await teacherInfoService();
    //console.log(result)
    teacherName.value = result.data.name;
}
getTeacherInfo()
import { useClassNameStore } from '@/stores/className.js'
const classNameStore = useClassNameStore();
const className = ref()
const getClassInfo = () => {
    className.value = classNameStore.className;
    //console.log(className.value)
}
getClassInfo();
import { useRouter } from 'vue-router';
const router = useRouter()
const returnHome = () => {
    router.push('/teacherHome');
};
const defaultActive = ref('/teacherClassJoin');

onMounted(() => {
    // 在页面加载完成后，进行路由导航到 "/teacherClassJoin" 页面
    defaultActive.value = '/teacherJoinConversation';
    // 也可以通过编程方式导航到指定路由
    router.push('/teacherJoinConversation');
});
</script>

<template>
    <el-container class="layout-container">
        <el-header>
            加入的课堂
            <div>课堂：<strong>{{ className }}</strong></div>
            <el-dropdown placement="bottom-end">
                <el-button @click="returnHome()">返回</el-button>
            </el-dropdown>
        </el-header>
        <div class="spacer"></div>
        <el-container>
            <!-- 左侧菜单 -->
            <el-aside width="200px">
                <!-- <div class="el-aside__logo"></div> -->
                <el-menu :default-active="defaultActive" active-text-color="#fff" background-color="#fff"
                    text-color="#000" router>
                    <el-menu-item index="/teacherJoinConversation">
                        <span>学生对话</span>
                    </el-menu-item>
                    <el-menu-item index="/teacherJoinStudent">
                        <span>学生管理</span>
                    </el-menu-item>
                </el-menu>
            </el-aside>
            <!-- 右侧主区域 -->
            <el-container>
                <!-- 头部区域 -->

                <!-- 中间区域 -->
                <el-main>
                    <!-- <div style="width: 1290px; height: 570px;border: 1px solid red;">
                    内容展示区
                </div> -->
                    <router-view>

                    </router-view>
                </el-main>
                <!-- 底部区域 -->
                <el-footer>问答通</el-footer>
            </el-container>
        </el-container>


    </el-container>
</template>

<style lang="scss" scoped>
.layout-container {
    height: 100vh;

    .el-menu-item.is-active {
        background-color: #0997F7 !important;
        /* 设置选中菜单项的背景颜色 */
    }

    .el-aside {
        background-color: #ffffff;
        width: 12%;

        .el-menu {
            border-right: none;
        }
    }

    .el-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 20px;
        width: 100%;
        background-color: #0997F7;
        color: #f5f5f5;
        font-size: large;
        height: 100px;

        .title_font {
            color: #f5f5f5;
            font-size: 40px;
            display: inline-block;
            margin-left: 40%;
            /* text-align: center; */
            position: absolute;
        }

        .el-dropdown__box {
            display: flex;
            align-items: center;

            .el-icon {
                color: #999;
                margin-left: 10px;
            }

            &:active,
            &:focus {
                outline: none;
            }
        }
    }

    .el-footer {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        color: #666;
    }
    .spacer {
        height: 20px;
        /* 设置间隔的高度 */
    }
}
</style>